import java.util.Objects;

public class Student {
    String id;
    int age;

    public Student() {
    }

    public Student(String id, int age) {
        this.id = id;
        this.age = age;
    }
    //自写
    /*public boolean equals(Object obj) {
        Student tmp = (Student) obj;
        if(tmp.id.equals(this.id) ){
            return true;
        }else{
            return false;
        }
    }

    public int hashCode(){
        return Objects.hash(id);
    }*/


    //自动编写

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Student student = (Student) o;
        return Objects.equals(id, student.id);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id);
    }
}
